<?php
/***
 * This files is not supposed to support the prettiest or best access,
 * but rather a catch-all for unoptimized pages. 
 *
 * No page should rely on this system, only
 *   * the global variables passed
 *
 * At current this is entirely unsafe and a jumple of includes
 * could definetly be simplified.
 ***/

// parse_ini_file is more efficient, but limits the depth.
// parse_ini_file('../page.ini', true);

$reqstr = $_REQUEST['uri'];
$req = explode('/',$reqstr);

// temporary for now until I can figure out what the fuck to do.
$token = array_shift($req);
switch( $token ) {
  case "handle":
    $runner = './handle.php';
    $page_uri = array_shift($req);
    break;
  case "view":
    $runner = './view.php';
    $page_uri = array_shift($req);
    if( !$page_uri ) 
      $page_uri = 'fora';
    break;
  default:
    $runner = './view.php';
    $page_uri = $token;
    if( !$page_uri ) 
      $page_uri = 'fora';
    break;
}

include($runner);
runner($page_uri, $req);

?>
